package com.gsk.europepharma.salesReport.struts.actions;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.ForwardAction;

public class DefaultAction extends ForwardAction {
	
	public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) 
			throws Exception {

		String cs_adm_pdt = request.getParameter("cs_adm_pdt");
		
		String cs_network = request.getParameter("cs_network");
		
		HttpSession sessionObject = request.getSession();
		
		if (cs_adm_pdt != null && cs_network != null) {
		
	        sessionObject.setAttribute("cs_adm_pdt", Integer.parseInt(cs_adm_pdt)); 
	        
	        sessionObject.setAttribute("cs_network", Integer.parseInt(cs_network));
	        
		} else {
			
			sessionObject.setAttribute("cs_adm_pdt", 0); 
	        
	        sessionObject.setAttribute("cs_network", 0);
	        
		}
		
		return mapping.findForward("success");
	}

}
